﻿@page "/"
@layout MainLayout

@using BlazorDemo.Configuration
@inject DemoConfiguration Configuration
@inject DemoThemeService Themes
@inject NavigationManager NavigationManager

@{
    RenderFragment<DemoProductInfo> DemoProduct = (info) =>
    @<div class="col-xl-4 col-lg-6 col-xs-12">
        <a class="demo-product" href="@info.PageUri">
            <div class="demo-product-icon demo-product-icon-@info.IconName">
                <svg role="img" title="@info.Title">
                    <use href="@(StaticAssetUtils.GetImagePath("products.svg"))#@info.IconName"></use>
                </svg>
            </div>
            <div class="flex-grow-1 text-body">
                <h5>@info.Title</h5>
                <span class="demo-product-info">@info.Description</span>
            </div>
        </a>
    </div>;
}

<div class="demo-products demo-products-description theme-@Themes.ActiveTheme.Name.Replace(" ", "-")">
    <h1 class="mb-4">DevExpress UI Components for Blazor</h1>
    <p>The <a href="https://www.devexpress.com/blazor/" target="_blank">DevExpress Blazor UI component suite</a> ships with a comprehensive suite of native Blazor components (including a DataGrid, Scheduler, Chart, Data Editors, Rich Text Editor, and Reporting). To learn more about the capabilities of our Blazor UI suite (for both Blazor Server and Blazor WebAssembly), select a product from the list below. DevExpress Blazor UI controls ship as part of the DevExpress ASP.NET Subscription.</p>
    <p>Should you have any questions about the products listed herein or are considering our UI components for an upcoming Blazor project, please email <a href="mailto:info@devexpress.com" tabindex="-1">info@devexpress.com</a>. We will be happy to follow-up.</p>
    <div class="row mb-3">
        @foreach(var info in Configuration.Products) {
            @DemoProduct.Invoke(info)
        }
    </div>
</div>

<h2 class="mb-4">Getting Started</h2>

<p>
    Refer to the following online resources to get started with DevExpress Blazor components:
</p>

<ul>
    <li><a href="https://docs.devexpress.com/Blazor/401055/prerequisites" target="_blank">Set up your Environment</a></li>
    <li><a href="https://docs.devexpress.com/Blazor/401058/demos#run-demos-locally" target="_blank">Run this demo on your machine</a></li>
    <li><a href="https://docs.devexpress.com/Blazor/401057/get-started" target="_blank">Create and configure a new project</a></li>
</ul>

<h2 class="my-4">Helpful Resources</h2>

<p>
    Our components come with extensive reference material, documentation, examples and step-by-step instructions. This material will help you not only start using our products from scratch, but also learn about all of their capabilities much faster.
</p>

<ul>
    <li><a href="https://docs.devexpress.com/Blazor/400725/blazor-components" target="_blank">Documentation</a></li>
    <li><a href="https://supportcenter.devexpress.com/ticket/list?preset=971248ea-952a-45d0-98e3-8b227de870f4" target="_blank">Examples</a></li>
    <li><a href="https://www.youtube.com/playlist?list=PL8h4jt35t1wiA7rjbbJQ0sYpsSghc7XYJ" target="_blank">Videos</a></li>
    <li><a href="https://github.com/DevExpress/Blazor/" target="_blank">GitHub repository</a></li>
    <li><a href="https://www.youtube.com/playlist?list=PL8h4jt35t1wjvwFnvcB2LlYL4jLRzRmoz" target="_blank">Free Blazor training course</a></li>
    <li><a href="https://docs.microsoft.com/en-us/aspnet/core/blazor/" target="_blank">Official Blazor documentation</a></li>
</ul>

<h2 class="my-4">Troubleshooting</h2>

<p>
    Need help or require more information? Explore the <a href="https://docs.devexpress.com/Blazor/401608/troubleshooting" target="_blank">Troubleshooting</a> help topic or submit your support inquiries via the <a href="https://supportcenter.devexpress.com/" target="_blank">DevExpress Support Center</a> for assistance.
</p>

@code {
    public override async Task SetParametersAsync(ParameterView parameters) {
        if(Configuration.ShowOnlyReporting)
            NavigationManager.NavigateTo("ReportViewer");
        else
            await base.SetParametersAsync(parameters);
    }
}
